home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / CODA_PSD.{9E < prev    next >
Text File  |  1999-09-17  |  4KB  |  131 lines

  1. #ifndef __CODA_PSDEV_H
  2. #define __CODA_PSDEV_H
  3.  
  4. #define CODA_PSDEV_MAJOR 67
  5. #define MAX_CODADEVS  5       /* how many do we allow */
  6.  
  7. extern struct venus_comm coda_upc_comm;
  8. extern struct coda_sb_info coda_super_info;
  9. #define CODA_SUPER_MAGIC    0x73757245
  10.  
  11. struct coda_sb_info
  12. {
  13.     struct inode *      sbi_psdev;     /* /dev/cfs? Venus/kernel device */
  14.     struct inode *      sbi_ctlcp;     /* control magic file */
  15.     int                 sbi_refct;
  16.     struct venus_comm *      sbi_vcomm;
  17.     struct inode *      sbi_root;
  18.     struct super_block *sbi_sb;
  19.     struct list_head    sbi_cchead;
  20.     struct list_head    sbi_volroothead;
  21. };
  22.  
  23. /* communication pending/processing queues */
  24. struct venus_comm {
  25.     u_long            vc_seq;
  26.     struct wait_queue  *vc_waitq; /* Venus wait queue */
  27.     struct list_head    vc_pending;
  28.     struct list_head    vc_processing;
  29.     int                 vc_inuse;
  30.     pid_t               vc_pid;   /* Venus pid */
  31. };
  32.  
  33.  
  34. static inline struct coda_sb_info *coda_sbp(struct super_block *sb)
  35. {
  36.     return ((struct coda_sb_info *)((sb)->u.generic_sbp));
  37. }
  38.  
  39.  
  40.  
  41. extern void coda_psdev_detach(int unit);
  42. extern int  init_coda_psdev(void);
  43.  
  44.  
  45. /* upcalls */
  46. int venus_rootfid(struct super_block *sb, ViceFid *fidp);
  47. int venus_getattr(struct super_block *sb, struct ViceFid *fid, 
  48.              struct coda_vattr *attr);
  49. int venus_setattr(struct super_block *, struct ViceFid *, 
  50.              struct coda_vattr *);
  51. int venus_lookup(struct super_block *sb, struct ViceFid *fid, 
  52.             const char *name, int length, int *type, 
  53.             struct ViceFid *resfid);
  54. int venus_release(struct super_block *sb, struct ViceFid *fid, int flags,
  55.           struct coda_cred *);
  56. int venus_open(struct super_block *sb, struct ViceFid *fid,
  57.           int flags, ino_t *ino, dev_t *dev);
  58. int venus_mkdir(struct super_block *sb, struct ViceFid *dirfid, 
  59.               const char *name, int length, 
  60.               struct ViceFid *newfid, struct coda_vattr *attrs);
  61. int venus_create(struct super_block *sb, struct ViceFid *dirfid, 
  62.             const char *name, int length, int excl, int mode, int rdev,
  63.             struct ViceFid *newfid, struct coda_vattr *attrs) ;
  64. int venus_rmdir(struct super_block *sb, struct ViceFid *dirfid, 
  65.             const char *name, int length);
  66. int venus_remove(struct super_block *sb, struct ViceFid *dirfid, 
  67.          const char *name, int length);
  68. int venus_readlink(struct super_block *sb, struct ViceFid *fid, 
  69.            char *buffer, int *length);
  70. int venus_rename(struct super_block *, struct ViceFid *new_fid, 
  71.          struct ViceFid *old_fid, size_t old_length, 
  72.          size_t new_length, const char *old_name, 
  73.          const char *new_name);
  74. int venus_link(struct super_block *sb, struct ViceFid *fid, 
  75.           struct ViceFid *dirfid, const char *name, int len );
  76. int venus_symlink(struct super_block *sb, struct ViceFid *fid,
  77.           const char *name, int len, const char *symname, int symlen);
  78. int venus_access(struct super_block *sb, struct ViceFid *fid, int mask);
  79. int venus_pioctl(struct super_block *sb, struct ViceFid *fid,
  80.          unsigned int cmd, struct PioctlData *data);
  81. int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb);
  82. int venus_fsync(struct super_block *sb, struct ViceFid *fid);
  83.  
  84.  
  85. /* messages between coda filesystem in kernel and Venus */
  86. extern int coda_hard;
  87. extern unsigned long coda_timeout;
  88. struct upc_req {
  89.     struct list_head    uc_chain;
  90.     caddr_t                uc_data;
  91.     u_short                uc_flags;
  92.     u_short             uc_inSize;  /* Size is at most 5000 bytes */
  93.     u_short                uc_outSize;
  94.     u_short                uc_opcode;  /* copied from data to save lookup */
  95.     int            uc_unique;
  96.     struct wait_queue  *uc_sleep;   /* process' wait queue */
  97.     unsigned long       uc_posttime;
  98. };
  99.  
  100. #define REQ_ASYNC  0x1
  101. #define REQ_READ   0x2
  102. #define REQ_WRITE  0x4
  103.  
  104.  
  105. /*
  106.  * Statistics
  107.  */
  108. struct coda_upcallstats {
  109.     int    ncalls;            /* client requests */
  110.     int    nbadcalls;        /* upcall failures */
  111.     int    reqs[CODA_NCALLS];    /* count of each request */
  112. } ;
  113.  
  114. extern struct coda_upcallstats coda_callstats;
  115.  
  116. static inline void clstats(int opcode)
  117. {
  118.     coda_callstats.ncalls++;
  119.     if ( (0 <= opcode) && (opcode <= CODA_NCALLS) )
  120.     coda_callstats.reqs[opcode]++;
  121.     else
  122.     printk("clstats called with bad opcode %d\n", opcode); 
  123. }
  124.  
  125. static inline void badclstats(void)
  126. {
  127.     coda_callstats.nbadcalls++;
  128. }
  129.  
  130. #endif
  131.